﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Parylene_CVD.Model
{
    // 设备信息和状态合并的实体类
    public class DeviceWithStatus : INotifyPropertyChanged
    {
        // 设备的基本信息字段
        public int DeviceId { get; set; }
        public string DeviceName { get; set; } = string.Empty;
        public string IP { get; set; } = string.Empty;
        public string Port { get; set; } = string.Empty;
        public DateTime CreateTime { get; set; }
        public DateTime UpdateTime { get; set; }

        // 设备状态字段
        private bool _isShutdown;
        public bool IsShutdown //关机
        {
            get => _isShutdown;
            set
            {
                if (_isShutdown != value)
                {
                    _isShutdown = value;
                    OnPropertyChanged(nameof(IsShutdown));
                }
            }
        }

        private bool _isStandby;
        public bool IsStandby //待机
        {
            get => _isStandby;
            set
            {
                if (_isStandby != value)
                {
                    _isStandby = value;
                    OnPropertyChanged(nameof(IsStandby));
                }
            }
        }

        private bool _isCoating;
        public bool IsCoating //镀膜
        {
            get => _isCoating;
            set
            {
                if (_isCoating != value)
                {
                    _isCoating = value;
                    OnPropertyChanged(nameof(IsCoating));
                }
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }


        // 构造函数
        public DeviceWithStatus() { }

        // 构造函数，可以初始化所有字段
        public DeviceWithStatus(int deviceId, string deviceName, string ip, string port, DateTime createTime, DateTime updateTime, bool isShutdown, bool isStandby, bool isCoating)
        {
            DeviceId = deviceId;
            DeviceName = deviceName;
            IP = ip;
            Port = port;
            CreateTime = createTime;
            UpdateTime = updateTime;
            IsShutdown = isShutdown;
            IsStandby = isStandby;
            IsCoating = isCoating;
        }

        public DeviceWithStatus(string deviceName, string iP, string port, DateTime createTime, DateTime updateTime, bool isShutdown, bool isStandby, bool isCoating)
        {
            DeviceName = deviceName;
            IP = iP;
            Port = port;
            CreateTime = createTime;
            UpdateTime = updateTime;
            IsShutdown = isShutdown;
            IsStandby = isStandby;
            IsCoating = isCoating;
        }
    }
}
